from django.db import models
# Create your models here.


class HbdMenu(models.Model):
    id = models.AutoField(primary_key=True)
    menu_name = models.CharField(null=False, max_length=200)
    menu_name_en = models.CharField(null=False, max_length=200)
    menu_url_dashboard = models.CharField(null=True, max_length=200)
    menu_url_detail = models.CharField(null=True, max_length=200)
    menu_url_rule = models.CharField(null=True, max_length=200)
    menu_validity = models.BooleanField(default=True, null=False)
    menu_auto_run = models.BooleanField(default=True, null=False)

    def __str__(self):
        return '[ id = ' + str(self.id) + " menu_name = " + self.menu_name + " menu_url_dashboard = " \
               + self.menu_url_dashboard + " menu_url_detail = " \
               + self.menu_url_detail + " menu_url_rule = " \
               + self.menu_url_rule + " menu_validity = " + str(self.menu_validity) + " ]"

    class Meta:
        db_table = 'hbd_menu'


class Aa10(models.Model):
    id = models.AutoField(primary_key=True)
    category = models.CharField(null=True, max_length=200)
    dm = models.CharField(null=False, max_length=200)
    pdm = models.CharField(null=True, max_length=200)
    cmc = models.CharField(null=False, max_length=200)
    effective = models.BooleanField(default=True, null=False)

    def __str__(self):
        return '[ id = ' + str(self.id) + " category = " + self.category + " dm = " \
               + self.dm + " pdm = " \
               + self.pdm + " cmc = " \
               + self.cmc + " effective = " + str(self.effective) + " ]"

    class Meta:
        db_table = 'hbd_aa10'


class DataStandardIndex(models.Model):
    pk_id = models.AutoField(primary_key=True)
    idx_id = models.IntegerField(null=True)
    idx_pid = models.IntegerField(null=True)
    idx_name = models.TextField(null=True)
    is_open = models.CharField(max_length=10, null=True)
    is_dir = models.BooleanField(default=False)

    def __str__(self):
        return '[ pk_id = ' + str(self.pk_id) + " idx_id = " + self.idx_id + " idx_pid = " \
               + self.idx_pid + " idx_name = " \
               + self.idx_name + " is_open = " + str(self.is_open) + " is_dir = " + str(self.is_dir) + " ]"

    class Meta:
        db_table = 'data_standard_index'






